/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitys;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "playlist")
@NamedQueries({
    @NamedQuery(name = "Playlist.findAll", query = "SELECT p FROM Playlist p"),
    @NamedQuery(name = "Playlist.findByPlId", query = "SELECT p FROM Playlist p WHERE p.plId = :plId"),
    @NamedQuery(name = "Playlist.findByPlName", query = "SELECT p FROM Playlist p WHERE p.plName = :plName"),
    @NamedQuery(name = "Playlist.findByPlDate", query = "SELECT p FROM Playlist p WHERE p.plDate = :plDate"),
    @NamedQuery(name = "Playlist.findByPlNumber", query = "SELECT p FROM Playlist p WHERE p.plNumber = :plNumber")})
public class Playlist implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "pl_id")
    private Integer plId;
    @Column(name = "pl_name")
    private Integer plName;
    @Column(name = "pl_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date plDate;
    @Column(name = "pl_number")
    private Integer plNumber;
    @JoinColumn(name = "usersid", referencedColumnName = "id")
    @ManyToOne
    private Users usersid;
    @JoinColumn(name = "videoid", referencedColumnName = "id")
    @ManyToOne
    private Video videoid;

    public Playlist() {
    }

    public Playlist(Integer plId) {
        this.plId = plId;
    }

    public Integer getPlId() {
        return plId;
    }

    public void setPlId(Integer plId) {
        this.plId = plId;
    }

    public Integer getPlName() {
        return plName;
    }

    public void setPlName(Integer plName) {
        this.plName = plName;
    }

    public Date getPlDate() {
        return plDate;
    }

    public void setPlDate(Date plDate) {
        this.plDate = plDate;
    }

    public Integer getPlNumber() {
        return plNumber;
    }

    public void setPlNumber(Integer plNumber) {
        this.plNumber = plNumber;
    }

    public Users getUsersid() {
        return usersid;
    }

    public void setUsersid(Users usersid) {
        this.usersid = usersid;
    }

    public Video getVideoid() {
        return videoid;
    }

    public void setVideoid(Video videoid) {
        this.videoid = videoid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (plId != null ? plId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Playlist)) {
            return false;
        }
        Playlist other = (Playlist) object;
        if ((this.plId == null && other.plId != null) || (this.plId != null && !this.plId.equals(other.plId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitys.Playlist[ plId=" + plId + " ]";
    }
    
}
